<section class="scrollable padder-md" data-ng-controller="RouteEditController">
    <div class="m-b-md">
        <a href="" class="btn btn-rounded  btn-sm btn-icon btn-default pull-right" data-ng-click="close()">
            <i class="fa fa-reply"></i>
        </a>
        <h3 class="m-b-none text-black">
            <i class="fa fa-edit m-r-sm"></i>
            路线- {{route.name || '新增'}}
        </h3>
    </div>

    <section class="panel panel-default">
        <div class="panel-body">
            <form name="routeSiteForm" class="form-horizontal">
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        路线名：
                    </label>
                    <div class="col-md-8">
                        <input type="text" class="form-control" data-ng-model="route.name" required/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        简称：
                    </label>
                    <div class="col-md-8">
                        <input type="text" class="form-control" data-ng-model="route.alias" required/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        站点：
                    </label>
                    <div class="col-md-8">
                        <div>
                            <div class="row">
                                <div class="col-md-8">名称</div>
                                <div class="col-md-4">
                                    <!--距离上一站的价格-->
                                </div>
                            </div>
                            <div ng-repeat="site in route.sites">

                                <div class="row">
                                    <div class="col-md-8">
                                        <div class="form-control" style="border: none">{{site.name}}</div>
                                    </div>
                                    <div class="col-md-4">
                                        <!--<input class="form-control pull-left" style="width: 70px" type="number"-->
                                        <!--data-ng-model="site.cost"-->
                                        <!--min="0">-->
                                        <span class="input-group-btn text-right">
                                            <!--排序-->
                                            <button class="btn btn-sm btn-icon btn-success"
                                                    ng-click="sortRouteSite(site,'up')">
                                                <i class="fa fa-arrow-up"></i>
                                            </button>

                                            <button class="btn btn-sm btn-icon btn-success"
                                                    ng-click="sortRouteSite(site,'down')">
                                                <i class="fa fa-arrow-down"></i>
                                            </button>
                                            <button class="btn btn-sm btn-icon btn-danger"
                                                    ng-click="removeRouteSite(site)">
                                                <i class="fa fa-remove"></i>
                                            </button>
                                         </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div>
                            <button class="btn  btn-sm btn-icon btn-success pull-right"
                                    ng-click="selectRouteSite()">
                                <i class="fa fa-plus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        总价格：
                    </label>
                    <div class="col-md-8">
                        <input name="cost" class="form-control" type="number" data-ng-model="route.cost" required
                               min="0"/>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        耗时(分钟)：
                    </label>
                    <div class="col-md-8">
                        <input name="costTime" class="form-control" type="number" data-ng-model="route.costTime"
                               required
                               min="0" placeholder="分钟"/>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        运营时间:
                    </label>
                    <div class="col-md-8">
                        <div class="row">
                            <div class="col-md-6">
                                <label class="control-label">
                                    首班车发车时间:
                                </label>
                                <select
                                        class="form-control"
                                        ng-model="route.allowStartTime"
                                        ng-options="time.value as time.label for time in timeRange">
                                </select>
                            </div>
                            <div class="col-md-6">
                                <label class="control-label">
                                    末班车发车时间:
                                </label>
                                <select
                                        class="form-control"
                                        ng-model="route.allowEndTime"
                                        ng-options="time.value as time.label for time in timeRange">
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        返程路线：
                    </label>
                    <div class="col-md-8">
                        <span style="line-height: 30px">{{route.reverseRouteId? route.reverseRouteName:"还没选择"}}</span>

                        <button class="btn  btn-sm btn-icon btn-success pull-right"
                                ng-click="selectReverseRoute()">
                            <i class="fa fa-search"></i>
                        </button>

                        <!--<button class="btn  btn-sm btn-icon btn-success pull-right"-->
                        <!--ng-click="createReverseRoute()" title="根据这个生成一个新的反向路线">-->
                        <!--<i class="fa fa-plus"></i>-->
                        <!--</button>-->

                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span class="mustinput">*</span>
                        是否启用：
                    </label>
                    <div class="col-md-8">
                        <label class="switch pull-left m-r-sm">
                            <input type="checkbox" data-ng-model="route.enable"
                                   data-ng-true-value="true" data-ng-false-value="false"
                                   data-ng-checked="route.enable==true">
                            <span></span>
                        </label>
                    </div>
                </div>

                <!-- 按钮 -->
                <div class="form-group text-right" style="margin-left: 15px; margin-right: 15px;">
                    <button type="button" class="btn btn-default" data-ng-click="close()">
                        <i class="i i-arrow"></i>
                        &nbsp;返回
                    </button>
                    <button type="submit" class="btn btn-success" data-ng-click="saveObj()">
                        <i class="fa fa-save"></i>
                        &nbsp;保存
                    </button>
                </div>
            </form>
        </div>
    </section>
</section>
